
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module newlib.SmapSubscription</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="newlib.html"><font color="#ffffff">newlib</font></a>.SmapSubscription</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/sdawson/svn/code/smap/newlib/SmapSubscription.py">/home/sdawson/svn/code/smap/newlib/SmapSubscription.py</a></font></td></tr></table>
    <p></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#aa55cc">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Modules</strong></big></font></td></tr>
    
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="BaseHTTPServer.html">BaseHTTPServer</a><br>
<a href="atexit.html">atexit</a><br>
<a href="copy.html">copy</a><br>
</td><td width="25%" valign=top><a href="httplib.html">httplib</a><br>
<a href="json.html">json</a><br>
<a href="logging.html">logging</a><br>
</td><td width="25%" valign=top><a href="socket.html">socket</a><br>
<a href="sys.html">sys</a><br>
<a href="threading.html">threading</a><br>
</td><td width="25%" valign=top><a href="time.html">time</a><br>
<a href="traceback.html">traceback</a><br>
<a href="urlparse.html">urlparse</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="BaseHTTPServer.html#BaseHTTPRequestHandler">BaseHTTPServer.BaseHTTPRequestHandler</a>(<a href="SocketServer.html#StreamRequestHandler">SocketServer.StreamRequestHandler</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="newlib.SmapSubscription.html#SmapSubscriptionHandler">SmapSubscriptionHandler</a>
</font></dt></dl>
</dd>
<dt><font face="helvetica, arial"><a href="threading.html#Thread">threading.Thread</a>(<a href="threading.html#_Verbose">threading._Verbose</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="newlib.SmapSubscription.html#SmapSubscription">SmapSubscription</a>
</font></dt><dt><font face="helvetica, arial"><a href="newlib.SmapSubscription.html#SmapSubscriptionManager">SmapSubscriptionManager</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="SmapSubscription">class <strong>SmapSubscription</strong></a>(<a href="threading.html#Thread">threading.Thread</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="newlib.SmapSubscription.html#SmapSubscription">SmapSubscription</a></dd>
<dd><a href="threading.html#Thread">threading.Thread</a></dd>
<dd><a href="threading.html#_Verbose">threading._Verbose</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="SmapSubscription-__init__"><strong>__init__</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscription-run"><strong>run</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscription-start"><strong>start</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscription-subscribe"><strong>subscribe</strong></a>(self, smap_root, resource, handler, rate<font color="#909090">=0</font>, localhost<font color="#909090">=None</font>)</dt></dl>

<hr>
Methods inherited from <a href="threading.html#Thread">threading.Thread</a>:<br>
<dl><dt><a name="SmapSubscription-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscription-getName"><strong>getName</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscription-isAlive"><strong>isAlive</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscription-isDaemon"><strong>isDaemon</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscription-is_alive"><strong>is_alive</strong></a> = isAlive(self)</dt></dl>

<dl><dt><a name="SmapSubscription-join"><strong>join</strong></a>(self, timeout<font color="#909090">=None</font>)</dt></dl>

<dl><dt><a name="SmapSubscription-setDaemon"><strong>setDaemon</strong></a>(self, daemonic)</dt></dl>

<dl><dt><a name="SmapSubscription-setName"><strong>setName</strong></a>(self, name)</dt></dl>

<hr>
Data descriptors inherited from <a href="threading.html#Thread">threading.Thread</a>:<br>
<dl><dt><strong>daemon</strong></dt>
</dl>
<dl><dt><strong>ident</strong></dt>
</dl>
<dl><dt><strong>name</strong></dt>
</dl>
<hr>
Data descriptors inherited from <a href="threading.html#_Verbose">threading._Verbose</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="SmapSubscriptionHandler">class <strong>SmapSubscriptionHandler</strong></a>(<a href="BaseHTTPServer.html#BaseHTTPRequestHandler">BaseHTTPServer.BaseHTTPRequestHandler</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="newlib.SmapSubscription.html#SmapSubscriptionHandler">SmapSubscriptionHandler</a></dd>
<dd><a href="BaseHTTPServer.html#BaseHTTPRequestHandler">BaseHTTPServer.BaseHTTPRequestHandler</a></dd>
<dd><a href="SocketServer.html#StreamRequestHandler">SocketServer.StreamRequestHandler</a></dd>
<dd><a href="SocketServer.html#BaseRequestHandler">SocketServer.BaseRequestHandler</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="SmapSubscriptionHandler-do_POST"><strong>do_POST</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionHandler-log_error"><strong>log_error</strong></a>(self, fmt, *args)</dt></dl>

<dl><dt><a name="SmapSubscriptionHandler-log_message"><strong>log_message</strong></a>(self, fmt, *args)</dt></dl>

<hr>
Methods inherited from <a href="BaseHTTPServer.html#BaseHTTPRequestHandler">BaseHTTPServer.BaseHTTPRequestHandler</a>:<br>
<dl><dt><a name="SmapSubscriptionHandler-address_string"><strong>address_string</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;client&nbsp;address&nbsp;formatted&nbsp;for&nbsp;logging.<br>
&nbsp;<br>
This&nbsp;version&nbsp;looks&nbsp;up&nbsp;the&nbsp;full&nbsp;hostname&nbsp;using&nbsp;gethostbyaddr(),<br>
and&nbsp;tries&nbsp;to&nbsp;find&nbsp;a&nbsp;name&nbsp;that&nbsp;contains&nbsp;at&nbsp;least&nbsp;one&nbsp;dot.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-date_time_string"><strong>date_time_string</strong></a>(self, timestamp<font color="#909090">=None</font>)</dt><dd><tt>Return&nbsp;the&nbsp;current&nbsp;date&nbsp;and&nbsp;time&nbsp;formatted&nbsp;for&nbsp;a&nbsp;message&nbsp;header.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-end_headers"><strong>end_headers</strong></a>(self)</dt><dd><tt>Send&nbsp;the&nbsp;blank&nbsp;line&nbsp;ending&nbsp;the&nbsp;MIME&nbsp;headers.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-handle"><strong>handle</strong></a>(self)</dt><dd><tt>Handle&nbsp;multiple&nbsp;requests&nbsp;if&nbsp;necessary.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-handle_one_request"><strong>handle_one_request</strong></a>(self)</dt><dd><tt>Handle&nbsp;a&nbsp;single&nbsp;HTTP&nbsp;request.<br>
&nbsp;<br>
You&nbsp;normally&nbsp;don't&nbsp;need&nbsp;to&nbsp;override&nbsp;this&nbsp;method;&nbsp;see&nbsp;the&nbsp;class<br>
__doc__&nbsp;string&nbsp;for&nbsp;information&nbsp;on&nbsp;how&nbsp;to&nbsp;handle&nbsp;specific&nbsp;HTTP<br>
commands&nbsp;such&nbsp;as&nbsp;GET&nbsp;and&nbsp;POST.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-log_date_time_string"><strong>log_date_time_string</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;current&nbsp;time&nbsp;formatted&nbsp;for&nbsp;logging.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-log_request"><strong>log_request</strong></a>(self, code<font color="#909090">='-'</font>, size<font color="#909090">='-'</font>)</dt><dd><tt>Log&nbsp;an&nbsp;accepted&nbsp;request.<br>
&nbsp;<br>
This&nbsp;is&nbsp;called&nbsp;by&nbsp;<a href="#SmapSubscriptionHandler-send_response">send_response</a>().</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-parse_request"><strong>parse_request</strong></a>(self)</dt><dd><tt>Parse&nbsp;a&nbsp;request&nbsp;(internal).<br>
&nbsp;<br>
The&nbsp;request&nbsp;should&nbsp;be&nbsp;stored&nbsp;in&nbsp;self.<strong>raw_requestline</strong>;&nbsp;the&nbsp;results<br>
are&nbsp;in&nbsp;self.<strong>command</strong>,&nbsp;self.<strong>path</strong>,&nbsp;self.<strong>request_version</strong>&nbsp;and<br>
self.<strong>headers</strong>.<br>
&nbsp;<br>
Return&nbsp;True&nbsp;for&nbsp;success,&nbsp;False&nbsp;for&nbsp;failure;&nbsp;on&nbsp;failure,&nbsp;an<br>
error&nbsp;is&nbsp;sent&nbsp;back.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-send_error"><strong>send_error</strong></a>(self, code, message<font color="#909090">=None</font>)</dt><dd><tt>Send&nbsp;and&nbsp;log&nbsp;an&nbsp;error&nbsp;reply.<br>
&nbsp;<br>
Arguments&nbsp;are&nbsp;the&nbsp;error&nbsp;code,&nbsp;and&nbsp;a&nbsp;detailed&nbsp;message.<br>
The&nbsp;detailed&nbsp;message&nbsp;defaults&nbsp;to&nbsp;the&nbsp;short&nbsp;entry&nbsp;matching&nbsp;the<br>
response&nbsp;code.<br>
&nbsp;<br>
This&nbsp;sends&nbsp;an&nbsp;error&nbsp;response&nbsp;(so&nbsp;it&nbsp;must&nbsp;be&nbsp;called&nbsp;before&nbsp;any<br>
output&nbsp;has&nbsp;been&nbsp;generated),&nbsp;logs&nbsp;the&nbsp;error,&nbsp;and&nbsp;finally&nbsp;sends<br>
a&nbsp;piece&nbsp;of&nbsp;HTML&nbsp;explaining&nbsp;the&nbsp;error&nbsp;to&nbsp;the&nbsp;user.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-send_header"><strong>send_header</strong></a>(self, keyword, value)</dt><dd><tt>Send&nbsp;a&nbsp;MIME&nbsp;header.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-send_response"><strong>send_response</strong></a>(self, code, message<font color="#909090">=None</font>)</dt><dd><tt>Send&nbsp;the&nbsp;response&nbsp;header&nbsp;and&nbsp;log&nbsp;the&nbsp;response&nbsp;code.<br>
&nbsp;<br>
Also&nbsp;send&nbsp;two&nbsp;standard&nbsp;headers&nbsp;with&nbsp;the&nbsp;server&nbsp;software<br>
version&nbsp;and&nbsp;the&nbsp;current&nbsp;date.</tt></dd></dl>

<dl><dt><a name="SmapSubscriptionHandler-version_string"><strong>version_string</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;server&nbsp;software&nbsp;version&nbsp;string.</tt></dd></dl>

<hr>
Data and other attributes inherited from <a href="BaseHTTPServer.html#BaseHTTPRequestHandler">BaseHTTPServer.BaseHTTPRequestHandler</a>:<br>
<dl><dt><strong>MessageClass</strong> = &lt;class mimetools.Message at 0x130a530&gt;</dl>

<dl><dt><strong>default_request_version</strong> = 'HTTP/0.9'</dl>

<dl><dt><strong>error_content_type</strong> = 'text/html'</dl>

<dl><dt><strong>error_message_format</strong> = '&lt;head&gt;<font color="#c040c0">\n</font>&lt;title&gt;Error response&lt;/title&gt;<font color="#c040c0">\n</font>&lt;/head&gt;<font color="#c040c0">\n</font>&lt;bo...ode explanation: %(code)s = %(explain)s.<font color="#c040c0">\n</font>&lt;/body&gt;<font color="#c040c0">\n</font>'</dl>

<dl><dt><strong>monthname</strong> = [None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']</dl>

<dl><dt><strong>protocol_version</strong> = 'HTTP/1.0'</dl>

<dl><dt><strong>responses</strong> = {100: ('Continue', 'Request received, please continue'), 101: ('Switching Protocols', 'Switching to new protocol; obey Upgrade header'), 200: ('OK', 'Request fulfilled, document follows'), 201: ('Created', 'Document created, URL follows'), 202: ('Accepted', 'Request accepted, processing continues off-line'), 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), 204: ('No Content', 'Request fulfilled, nothing follows'), 205: ('Reset Content', 'Clear input form for further input.'), 206: ('Partial Content', 'Partial content follows.'), 300: ('Multiple Choices', 'Object has several resources -- see URI list'), ...}</dl>

<dl><dt><strong>server_version</strong> = 'BaseHTTP/0.3'</dl>

<dl><dt><strong>sys_version</strong> = 'Python/2.6.4'</dl>

<dl><dt><strong>weekdayname</strong> = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']</dl>

<hr>
Methods inherited from <a href="SocketServer.html#StreamRequestHandler">SocketServer.StreamRequestHandler</a>:<br>
<dl><dt><a name="SmapSubscriptionHandler-finish"><strong>finish</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionHandler-setup"><strong>setup</strong></a>(self)</dt></dl>

<hr>
Data and other attributes inherited from <a href="SocketServer.html#StreamRequestHandler">SocketServer.StreamRequestHandler</a>:<br>
<dl><dt><strong>rbufsize</strong> = -1</dl>

<dl><dt><strong>wbufsize</strong> = 0</dl>

<hr>
Methods inherited from <a href="SocketServer.html#BaseRequestHandler">SocketServer.BaseRequestHandler</a>:<br>
<dl><dt><a name="SmapSubscriptionHandler-__init__"><strong>__init__</strong></a>(self, request, client_address, server)</dt></dl>

</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="SmapSubscriptionManager">class <strong>SmapSubscriptionManager</strong></a>(<a href="threading.html#Thread">threading.Thread</a>)</font></td></tr>
    
<tr><td bgcolor="#ffc8d8"><tt>&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="newlib.SmapSubscription.html#SmapSubscriptionManager">SmapSubscriptionManager</a></dd>
<dd><a href="threading.html#Thread">threading.Thread</a></dd>
<dd><a href="threading.html#_Verbose">threading._Verbose</a></dd>
<dd><a href="__builtin__.html#object">__builtin__.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="SmapSubscriptionManager-__init__"><strong>__init__</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-run"><strong>run</strong></a>(self)</dt></dl>

<hr>
Methods inherited from <a href="threading.html#Thread">threading.Thread</a>:<br>
<dl><dt><a name="SmapSubscriptionManager-__repr__"><strong>__repr__</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-getName"><strong>getName</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-isAlive"><strong>isAlive</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-isDaemon"><strong>isDaemon</strong></a>(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-is_alive"><strong>is_alive</strong></a> = isAlive(self)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-join"><strong>join</strong></a>(self, timeout<font color="#909090">=None</font>)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-setDaemon"><strong>setDaemon</strong></a>(self, daemonic)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-setName"><strong>setName</strong></a>(self, name)</dt></dl>

<dl><dt><a name="SmapSubscriptionManager-start"><strong>start</strong></a>(self)</dt></dl>

<hr>
Data descriptors inherited from <a href="threading.html#Thread">threading.Thread</a>:<br>
<dl><dt><strong>daemon</strong></dt>
</dl>
<dl><dt><strong>ident</strong></dt>
</dl>
<dl><dt><strong>name</strong></dt>
</dl>
<hr>
Data descriptors inherited from <a href="threading.html#_Verbose">threading._Verbose</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-send_subscribe"><strong>send_subscribe</strong></a>(url, create_object, resource<font color="#909090">='/reporting/create'</font>)</dt></dl>
 <dl><dt><a name="-unsubscribe"><strong>unsubscribe</strong></a>()</dt><dd><tt>#&nbsp;SDH&nbsp;:&nbsp;this&nbsp;would&nbsp;be&nbsp;nice&nbsp;if&nbsp;the&nbsp;python&nbsp;multithread&nbsp;signal&nbsp;handling&nbsp;wasn't&nbsp;so&nbsp;broken</tt></dd></dl>
</td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>LEASE_TIME</strong> = 900<br>
<strong>lock</strong> = &lt;thread.lock object at 0x7f166a595150&gt;<br>
<strong>subscriptions</strong> = {}</td></tr></table>
</body></html>